home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: EU.net!chsun!usenet
- From: rop@dial.eunet.ch@dial.eunet.ch
- Subject: Re: RW Tools.h++'s persistence - second try
- Message-ID: <DMBJ0H.FEq@eunet.ch>
- Sender: usenet@eunet.ch
- Reply-To: rop@dial.eunet.ch
- Organization: A customer of EUnet AG, Switzerland
- X-Newsreader: IBM NewsReader/2 v1.2.5
- References: <4e5h7q$sip@rc1.vub.ac.be>
- Date: Mon, 5 Feb 1996 19:48:16 GMT
-
- In <4e5h7q$sip@rc1.vub.ac.be>, kpgoderi@etro3 (Karel Goderis) writes:
- >Ugh... some newsreaders suck - here is the posting
- >
- >
- >Watch this small piece of code, and then the warnings I get when
- >compiling the code. The persistence machinary do write the stuff in a
- >decent way, but reading messes up.
- >
- >class Coordinate : public RWCollectable {
- >
- > RWDECLARE_COLLECTABLE(Coordinate)
- >
- >public:
- > Coordinate();
- >
- > int x;
- > int y;
- >
- > //From RwCollectable - for persistence
- > virtual void restoreGuts(RWFile& f);
- > virtual void restoreGuts(RWvistream& strm);
- > virtual void saveGuts(RWFile& f) const;
- > virtual void saveGuts(RWvostream& strm) const;
- >
- >};
- >
- >
- >here follows the code for the persistence stuff . I omitted a lot of the code
- >
- >
- >void Coordinate::restoreGuts(RWvistream& strm)
- >{
- > RWCollectable::restoreGuts(strm);
- >
- > strm >> x; // this is line 1144 of the error report
- > strm >> y;
- >
- >}
- >
- >
- >
- >.... and the error of the compiler
- >
- >
- >"ROI.cc", line 1144: Warning (Anachronism): Temporary created for
- >argument cstr in call to operator>>(RWvistream&, RWCString&).
- >"ROI.cc", line 1145: Warning (Anachronism): Temporary created for
- >argument cstr in call to operator>>(RWvistream&, RWCString&).
- >
- >
- >.... which makes that every read results in a (-1,-1) coordinate, and that
- >is not actually the goal of it :)
- >
- >--
- > Karel Goderis
- >
- >
- > VUB - Vrije Universiteit Brussel
- > Personal --- kpgoderi@etro.vub.ac.be
- >
- > IGUANA - Indepent Group of Unix-alikes and Networking activists
- > Personal --- scollie@medelec.uia.ac.be
- >
- > BEST - Board of European Students of Technology
- > General --- twbest00@vub.ac.be
-
- I can remeber we had the same problem, but try this (I am going to check
- tomorrow if my memory failed or not):
-
- {
- strm >> (int&) x;
- strm >> (int&) y;
-
- }
-
- ROTZETTER Patrick (rop@dial.eunet.ch)
- Deutsche Bank (Suisse) S.A.
- Voice:+41 22 7390588
- Fax:+41 22 7390386
-
-